fix: resolve 5 cross-package bugs causing test failures#10
Open
stooit wants to merge 1 commit into
Open
Conversation
- Fix renamed hook import: use useDebounce (actual export) in api.ts - Add jsdom test environment config for UI package DOM tests - Pass aria-label prop through in Button component for icon-only buttons - Fix date format to use day without leading zero (d/MM/yyyy) - Fix stale closure in DataTable sort handler using functional updater
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes all failing tests across the monorepo by resolving 5 cross-package bugs:
apps/web/src/lib/api.ts): The file importeduseSearchDebounceanduseThrottlefrom@e2e/utils, but the actual exports areuseDebounceanduseDebouncedValue. Updated imports to use the correct names.packages/ui/bunfig.toml): UI component tests use@testing-library/reactwhich requires a DOM. Addedhappy-dompreload to the bun test config.packages/ui/src/components/Button/Button.tsx): Icon-only buttons were not passing through thearia-labelprop. Fixed the component to spread/forward the aria-label attribute.packages/utils/src/format/date.ts):formatDateuseddd/MM/yyyy(zero-padded day) but tests expectedd/MM/yyyy(no leading zero). Fixed the format string.packages/ui/src/components/DataTable/DataTable.tsx): The sort click handler captured stale state. Fixed by using a functional state updater to always read the latest sort direction.Verification
All 13 tests pass (
bun test). TypeScript compilation clean (onlybun:testmodule errors remain in test files, which is expected and cannot be fixed without modifying test files).Assumptions
bun:testTypeScript errors are acceptable since they only appear in test files (which are not to be modified) and bun resolves them at runtime.happy-domwas already available innode_modulesas a dependency.